package com.guan.study.easyExcelDemo;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentStyle;
import com.alibaba.excel.annotation.write.style.HeadStyle;
import com.alibaba.excel.enums.poi.FillPatternTypeEnum;
import com.alibaba.excel.enums.poi.HorizontalAlignmentEnum;
import com.alibaba.excel.enums.poi.VerticalAlignmentEnum;
import io.swagger.annotations.ApiModel;
import javafx.scene.layout.BackgroundFill;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;

/**
 * @Date: 2023/7/4 18:07
 * @Author: yaobai
 * @Description:
 */
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value="学生对象", description="学生对象")
@ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.CENTER,
        verticalAlignment = VerticalAlignmentEnum.CENTER)
@HeadStyle(fillPatternType = FillPatternTypeEnum.SOLID_FOREGROUND, fillForegroundColor = 100)
public class Student {

    @ExcelProperty(value = "姓名", index = 0)
    @ColumnWidth(20)
    @NotBlank(message = "姓名不能为空")
    private String name;

    @ExcelProperty(value = "年龄", index = 1)
    @ColumnWidth(20)
    @Length(max = 3,message = "年龄最大为百岁")
    private Integer age;

    @ExcelProperty(value = "地址", index = 2)
    @ColumnWidth(20)
    @Length(max = 10,message = "地址信息过长")
    private String addr;

    @ExcelProperty(value = "学校", index = 3)
    @ColumnWidth(20)
    private String school;

    //private String course;
    @ExcelProperty(value = {"科目","语文"}, index = 4)
    @ColumnWidth(20)
    private String chinese;

    @ExcelProperty(value = {"科目","数学"}, index = 5)
    @ColumnWidth(20)
    private String math;

    @ExcelProperty(value = {"科目","英语"}, index = 6)
    @ColumnWidth(20)
    private String english;

}
